package com.wires.lu.practice;

import java.lang.ref.WeakReference;

/**
 * 弱引用
 */
public class WeakReferenceDemo {


    public static void main(String[] args) {
        Object obj=new Object();
        WeakReference<Object> weakReference=new WeakReference<>(obj);
        System.out.println(obj);
        System.out.println(weakReference.get());
        obj=null;
        System.gc();
        System.out.println("==================");
        System.out.println(obj);
        System.out.println(weakReference.get());
    }

}
